<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport"
        content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>宣教内容-frame</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../css/style.css" />
    <link rel="stylesheet" type="text/css" href="../css/aui.2.0.css" />
    <style>
        html,
        body {
            background-color: transparent;
        }

        [v-cloak] {
            display: none;
        }

        .expend-cabin-wrapper>span {
            display: inline-block;
            font-size: 14px;
        }

        .aui-btn-info.add-cabin-info-btn {
            position: fixed;
            right: 10px;
            bottom: 100px;
        }

        .aui-btn-info.add-cabin-change-btn {
            position: fixed;
            right: 17px;
            top: 230px;
            z-index: 11;
        }

        .cabin-info {
            position: fixed;
            top: 50px;
            left: 0;
            z-index: 1000;
            height: 100vh;
            width: 100%;
            background-color: rgba(255, 255, 255, 1);
        }

        .add-cabin-info {
            width: 100%;
        }

        .aui-card-list {
            background-color: transparent;
        }

        .aui-btn-sm {
            width: 300px;
            margin: 20px auto;
        }

        .aui-list-item.aui-list-item-middle {
            width: 95%;
            margin: 0 auto;
            border-radius: 10px;
            -moz-box-shadow: 1px 4px 20px #C2C2C2;
            -webkit-box-shadow: 1px 4px 20px #C2C2C2;
            box-shadow: 1px 4px 20px #C2C2C2;
        }

        .aui-list-item-text {
            display: -webkit-flex;
            display: flex;
            justify-content: flex-start;
            align-items: center;
        }

        .aui-list-item-text>span {
            flex: 1;
        }

        .patient-container {
            display: -webkit-flex;
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            padding: 0 15px;
            -webkit-box-sizing: border-box;
            box-sizing: border-box;
        }

        .patient-wrapper {
            background-color: #fff;
            padding: 10px;
            border-radius: 10px;
            -moz-box-shadow: 1px 4px 20px #C2C2C2;
            -webkit-box-shadow: 1px 4px 20px #C2C2C2;
            box-shadow: 1px 4px 20px #C2C2C2;
            width: 49%;
            margin-top: 20px;
        }

        .patient-wrapper>div {
            display: -webkit-flex;
            display: flex;
            justify-content: space-around;
            align-items: center;
            width: 100%;
        }

        .patient-wrapper>div>span:nth-child(1) {
            width: 45%;
            text-align: center;
        }

        .patient-wrapper>div>span:nth-child(2) {
            width: 55%;
            text-align: left;
            -webkit-box-sizing: border-box;
            box-sizing: border-box;
        }

        .aui-tab {
            display: flex;
            display: -webkit-flex;
            flex-direction: column;
            float: left;
            position: relative;
            top: 50px;
        }

        .aui-tab>div {
            width: 100px;
            height: 50px;
        }

        .aui-tab::after {
            display: none;
        }

        .aui-padded-5 {
            float: left;
        }

        .tab-container {
            display: -webkit-flex;
            display: flex;
            justify-content: flex-start;
            width: 94%;
            margin: 0 auto;
            background-color: #fff;
        }

        .tab-container>div:nth-child(1) {
            width: 16%;
            border-radius: 10px;
            overflow: hidden;
            height: calc(100vh - 160px);
        }

        .tab-container>div:nth-child(1)>div {
            width: 100%;
            text-align: center;
        }

        .tab-container>div:nth-child(2) {
            width: 84%;
            background-color: #fff;
            text-align: left;
            border-radius: 10px;
            overflow: hidden;
            padding: 20px;
            height: calc(100vh - 80px);
        }

        #tab {
            border-radius: 10px;
        }

        .aui-list.aui-media-list::after,
        .aui-list.aui-media-list::before {
            display: none !important;
        }

        .aui-grid {
            width: 93%;
            margin: 0 3%;
            position: fixed;
            bottom: 0;
            right: 0;
            height: 90px !important;
            padding-top: 20px;
            background-color: #ffffff;
            z-index: 999;
            display: none;
        }

        .aui-col-xs-4 {
            padding: 0.5rem 0 !important;
            height: 80px !important;
        }

        .aui-radio,
        .aui-checkbox {
            width: 25px !important;
            height: 25px !important;
        }

        .aui-list .aui-list-item,
        .aui-list-item-inner {
            min-height: 45px !important;
        }

        .aui-list-item-input>label {
            font-size: 14px;
        }

        .aui-list-item-input>label>input {
            margin-right: 5px;
        }

        .aui-checkbox {
            margin-top: 3px;
        }

        .aui-btn-info.add-cabin-info-btn {
            position: fixed;
            right: 18px;
            top: 176px;
            z-index: 100;
            height: 35px;
        }

        .aui-grid [class*=aui-col-] {
            padding: 0 !important;
        }

        .aui-tab-item {
            position: relative;
        }

        .aui-tab-item>span {
            display: block;
            width: 5px;
            height: 5px;
            border-radius: 50%;
            background-color: #ff2600;
            position: absolute;
            top: 15px;
            right: 13px;
        }

        .aui-col-xs-4 {
            padding: 0 0 !important;
            height: 45px !important;
            line-height: 45px !important;
        }
    </style>
</head>

<body>
    <main id="app">
        <h1 style="text-align: center;padding-top: 30px;" id="Broadcast"></h1>
        <section class="aui-content" id="InspectionContent" style="font-size: 15px;text-align: center;">

            <div class="aui-card-list">
                <div class="aui-card-list-header">
                    工作记录
                </div>
                <div style="font-size:14px;" class="aui-card-list-content-padded aui-border-t">
                    <span class="aui-col-xs-12">
                        <span class="aui-col-xs-4">
                            进行安全宣教
                        </span>
                        <span class="aui-col-xs-4">
                            督促病人调压
                        </span>
                        <span class="aui-col-xs-4">
                            指导病人舱内装置的使用
                        </span>
                    </span>
                    <span class="aui-col-xs-12">
                        <span class="aui-col-xs-4">
                            及时通知病人戴面罩吸氧
                        </span>
                        <span class="aui-col-xs-4">
                            病人无感冒、腹泻
                        </span>
                        <span class="aui-col-xs-4">
                            治疗时多次询问病人有无不适
                        </span>
                    </span>
                    <span class="aui-col-xs-12">
                        <span class="aui-col-xs-4">
                            有事随时触碰蓝色报警器
                        </span>
                        <span class="aui-col-xs-4">
                            治疗时氧压稳定、舱压稳定
                        </span>
                        <span class="aui-col-xs-4">
                            更换纯棉衣物
                        </span>
                    </span>
                    <span class="aui-col-xs-12">
                        <span class="aui-col-xs-4">
                            随时了解病人吸氧状况
                        </span>
                        <span class="aui-col-xs-4">
                            无违禁物品进舱
                        </span>
                        <span class="aui-col-xs-4">
                            通知病人休息
                        </span>
                    </span>
                    <span class="aui-col-xs-12">
                        <span class="aui-col-xs-4">
                            进行心理疏导
                        </span>
                        <span class="aui-col-xs-4">
                            通知病人开始减压
                        </span>
                        <span class="aui-col-xs-4">
                            指导病人正确减压
                        </span>
                    </span>
                    <span class="aui-col-xs-12">
                        <span class="aui-col-xs-4">
                            减压时打开引流管
                        </span>
                        <span class="aui-col-xs-4">
                            知道面罩正确佩戴
                        </span>
                        <span class="aui-col-xs-4">
                            通知病人减压时严禁屏气
                        </span>
                    </span>
                    <span class="aui-col-xs-12">
                        <span class="aui-col-xs-4">
                            升压时关闭引流管
                        </span>
                        <span class="aui-col-xs-4">
                            减压时通知病人注意保暖
                        </span>
                        <span class="aui-col-xs-4">
                            通知病人开始升压
                        </span>
                    </span>
                    <span class="aui-col-xs-12">
                        <span class="aui-col-xs-4">出舱后观察病情</span>
                    </span>
                </div>
                <div class="aui-card-list-footer aui-border-t">
                    <div class="aui-col-xs-6 aui-content-padded">
                        <label><input name="read" class="aui-checkbox" type="checkbox" checked> 我已阅读并知晓上述内容</label>
                    </div>
                    <div class="aui-col-xs-6">
                        <!-- <div class="aui-col-xs-6">
                            <div class="aui-btn" onclick="ce()"><span style="font-size: 0.7rem;"
                                    class="aui-iconfont aui-icon-back"></span>返回</div>
                        </div> -->
                        <div class="aui-col-xs-6">
                            <div class="aui-btn aui-btn-info" onclick="openSign()"><span style="font-size: 0.7rem;"
                                    class="aui-iconfont aui-icon-pencil"></span>签字</div>
                        </div>
                    </div>
                </div>
                <div class="aui-card-list-footer aui-border-t">
                    <span class="aui-col-xs-3">
                        <img src="" id="oaAutographOne" style="width:100px; height:50px;">
                    </span>
                    <span class="aui-col-xs-3">
                        <img src="" id="oaAutographTwo" style="width:100px; height:50px;">
                    </span>
                    <span class="aui-col-xs-3">
                        <img src="" id="oaAutographThree" style="width:100px; height:50px;">
                    </span>
                    <span class="aui-col-xs-3">
                        <img src="" id="oaAutographFour" style="width:100px; height:50px;">
                    </span>
                    <span class="aui-col-xs-3">
                        <img src="" id="oaAutographFive" style="width:100px; height:50px;">
                    </span>
                    <span class="aui-col-xs-3">
                        <img src="" id="oaAutographSix" style="width:100px; height:50px
                        ;">
                    </span>
                </div>
                <div class="aui-card-list-footer">
                    <span class="aui-col-xs-3">
                        <img src="" id="oaAutographSeven" style="width:100px; height:50px;">
                    </span>
                    <span class="aui-col-xs-3">
                        <img src="" id="oaAutographEight" style="width:100px; height:50px;">
                    </span>
                    <span class="aui-col-xs-3">
                        <img src="" id="oaAutographNine" style="width:100px; height:50px;">
                    </span>
                    <span class="aui-col-xs-3">
                        <img src="" id="oaAutographTen" style="width:100px; height:50px;">
                    </span>
                    <span class="aui-col-xs-3">
                        <img src="" id="oaAutographEleven" style="width:100px; height:50px;">
                    </span>
                    <span class="aui-col-xs-3">
                        <img src="" id="oaAutographTwelve" style="width:100px; height:50px;">
                    </span>
                </div>
                <div class="aui-card-list-footer">
                    <span class="aui-col-xs-3">
                        <img src="" id="oaAutographThirteen" style="width:100px; height:50px;">
                    </span>
                    <span class="aui-col-xs-3">
                        <img src="" id="oaAutographFourteen" style="width:100px; height:50px;">
                    </span>
                    <span class="aui-col-xs-3">
                        <img src="" id="oaAutographFifteen" style="width:100px; height:50px;">
                    </span>
                    <span class="aui-col-xs-3">
                        <img src="" id="oaAutographSixteen" style="width:100px; height:50px;">
                    </span>
                    <span class="aui-col-xs-3">
                        <img src="" id="oaAutographSeventeen" style="width:100px; height:50px;">
                    </span>
                    <span class="aui-col-xs-3">
                        <img src="" id="oaAutographEighteen" style="width:100px; height:50px;">
                    </span>

                </div>
                <div class="aui-card-list-footer">
                    <span class="aui-col-xs-3">
                        <img src="" id="oaAutographNineteen" style="width:100px; height:50px;">
                    </span>
                    <img src="" id="oaAutographTwenty" style="width:100px; height:50px;">
                    </span>
                    <span class="aui-col-xs-3">
                        <img src="" id="oaAutographTwentyOne" style="width:100px; height:50px;">
                    </span>
                    <span class="aui-col-xs-3">
                        <img src="" id="oaAutographTwentyTwo" style="width:100px; height:50px;">
                    </span>
                    <span class="aui-col-xs-3">
                        <img src="" id="oaAutographTwentyThree" style="width:100px; height:50px;">
                    </span>
                    <span class="aui-col-xs-3">
                        <img src="" id="oaAutographTwentyFour" style="width:100px; height:50px;">
                    </span>

                </div>
            </div>
        </section>
        <section class="aui-grid" id="caozuo">
            <div class="aui-col-xs-3" onclick="closeSign()">
                <i class="aui-iconfont aui-icon-close"></i>
                <div class="aui-grid-label">隐藏签名板</div>
            </div>
            <div class="aui-col-xs-3" onclick="cancelStep()">
                <i class="aui-iconfont aui-icon-recovery"></i>
                <div class="aui-grid-label">撤销</div>
            </div>
            <div class="aui-col-xs-6" style="color: blue" onclick="saveSigns()">
                <i class="aui-iconfont aui-icon-paper" style="color: blue"></i>
                <div class="aui-grid-label" style="color: blue;">确定</div>
            </div>
            <!-- <div class="aui-col-xs-3" onclick="clearSign()">
                <i class="aui-iconfont aui-icon-refresh"></i>
                <div class="aui-grid-label">清除全部</div>
            </div> -->
        </section>

    </main>
</body>

</html>

<script src="../script/api.js" charset="utf-8" type="text/javascript"></script>
<script src="../script/vue.js" charset="utf-8" type="text/javascript"></script>
<script src="../js/jquery.min.js" charset="utf-8" type="text/javascript"></script>
<script src="../js/ToConfigure.js" charset="utf-8" type="text/javascript"></script>
<script src="../script/aui-toast.js" charset="utf-8" type="text/javascript"></script>
<script src="../script/aui-dialog.js" charset="utf-8" type="text/javascript"></script>
<script src="../script/aui-tab.js" charset="utf-8" type="text/javascript"></script>
<script type="text/javascript">
    //记录当前第几次签名，如无数据默认从0开始
    var frequency = 0;
    var vm = null;
    //记录宣教记录id
    var oasID = 0;
    apiready = function () {
        vm = new Vue({
            el: '#app',
            data: {
                F_HatchID: 0, //舱次Id
            },
            created() {
                //调取加载
                // api.showProgress({
                //     title: '打开签名板...',
                //     text: '',
                //     modal: true
                // });
                //获取所属医院IP地址
                this.Url_IP = ToConfigure_IP("Gorgeous");
                //获取操舱记录单id
                var cfId = api.pageParam.F_HatchID;
                getHoOxygenAutograph(cfId);
                //默认加载打开签名板
                // if (frequency < 16) {
                //     openSign();
                // } else {
                //     alert("签名人数已满，无法继续签名。");
                // }
                //关闭加载
                // api.hideProgress();
            },
            methods: {}
        })
    }
    //修改签名
    function updateHoOxygenAutograph(oaID, base64) {
        var JSpars = new Object;
        if (oaID > 0 && oaID != null) {
            JSpars.oaId = oaID;
            if (frequency == 0 && frequency != null && frequency != undefined) {
                JSpars.oaAutographOne = base64;
            } else if (frequency == 1 && frequency != null && frequency != undefined) {
                JSpars.oaAutographTwo = base64;
            } else if (frequency == 2 && frequency != null && frequency != undefined) {
                JSpars.oaAutographThree = base64;
            } else if (frequency == 3 && frequency != null && frequency != undefined) {
                JSpars.oaAutographFour = base64;
            } else if (frequency == 4 && frequency != null && frequency != undefined) {
                JSpars.oaAutographFive = base64;
            } else if (frequency == 5 && frequency != null && frequency != undefined) {
                JSpars.oaAutographSix = base64;
            } else if (frequency == 6 && frequency != null && frequency != undefined) {
                JSpars.oaAutographSeven = base64;
            } else if (frequency == 7 && frequency != null && frequency != undefined) {
                JSpars.oaAutographEight = base64;
            } else if (frequency == 8 && frequency != null && frequency != undefined) {
                JSpars.oaAutographNine = base64;
            } else if (frequency == 9 && frequency != null && frequency != undefined) {
                JSpars.oaAutographTen = base64;
            } else if (frequency == 10 && frequency != null && frequency != undefined) {
                JSpars.oaAutographEleven = base64;
            } else if (frequency == 11 && frequency != null && frequency != undefined) {
                JSpars.oaAutographTwelve = base64;
            } else if (frequency == 12 && frequency != null && frequency != undefined) {
                JSpars.oaAutographThirteen = base64;
            } else if (frequency == 13 && frequency != null && frequency != undefined) {
                JSpars.oaAutographFourteen = base64;
            } else if (frequency == 14 && frequency != null && frequency != undefined) {
                JSpars.oaAutographFifteen = base64;
            } else if (frequency == 15 && frequency != null && frequency != undefined) {
                JSpars.oaAutographSixteen = base64;
            } else if (frequency == 16 && frequency != null && frequency != undefined) {
                JSpars.oaAutographSeventeen = base64;
            } else if (frequency == 17 && frequency != null && frequency != undefined) {
                JSpars.oaAutographEighteen = base64;
            } else if (frequency == 18 && frequency != null && frequency != undefined) {
                JSpars.oaAutographNineteen = base64;
            } else if (frequency == 19 && frequency != null && frequency != undefined) {
                JSpars.oaAutographTwenty = base64;
            } else if (frequency == 20 && frequency != null && frequency != undefined) {
                JSpars.oaAutographTwentyOne = base64;
            } else if (frequency == 21 && frequency != null && frequency != undefined) {
                JSpars.oaAutographTwentyTwo = base64;
            } else if (frequency == 22 && frequency != null && frequency != undefined) {
                JSpars.oaAutographTwentyThree = base64;
            } else if (frequency == 23 && frequency != null && frequency != undefined) {
                JSpars.oaAutographTwentyFour = base64;
            }
            var toast = new auiToast();
            //获取所属医院IP地址
            var Url_IP = ToConfigure_IP("Gorgeous");
            /**
            * 请求控制器
            */
            $.ajax({
                url: Url_IP + '/businessmanagement/cabinoperationrecord/updateHoOxygenAutograph',
                type: 'post',
                async: false,
                contentType: "application/json",
                dataType: "json",
                data: JSON.stringify(JSpars),
                success: function (result) {

                    /**
                     * 验证返回信息是否为空
                     */
                    if (result.success == true) {
                        frequency = (frequency + 1);
                        $("#Broadcast").text("当前已签患者：" + frequency + "位");
                        /**
                         * 调取签名
                         */
                        // openSign();
                        /**
                         * 关闭签名
                         * 
                        */
                        closeSign();
                        // /**
                        //  * 清空已选中的checkbox
                        //  * 
                        // */
                        // document.getElementsByName("read")[0].checked = false;
                        /**
                         * 操作成功提醒
                         */
                        toast.success({
                            title: "提交成功",
                            duration: 2000
                        });
                    } else {
                        /**
                         *  提示错误信息
                         */
                        toast.fail({
                            title: "提交失败",
                            duration: 2000
                        });
                    }
                },
                error: function (result) {
                    /**
                     *  提示错误信息
                     */
                    toast.fail({
                        title: "提交失败",
                        duration: 2000
                    });
                }
            })

        } else {
            return;
        }
    }
    //查询宣教记录表
    function getHoOxygenAutograph(oaCorId) {
        var Url_IP = ToConfigure_IP("Gorgeous");
        var toast = new auiToast();
        if (oaCorId > 0 && oaCorId != null) {
            var JSparss = new Object;
            JSparss.oaCorId = oaCorId;
            console.log(JSON.stringify(JSparss))

            $.ajax({
                url: Url_IP + '/businessmanagement/cabinoperationrecord/getHoOxygenAutograph',
                type: 'post',
                async: false,
                contentType: "application/json",
                dataType: "json",
                data: JSON.stringify(JSparss),
                success: function (result) {

                    /**
                     * 验证返回信息是否为空
                     */
                    console.log(result.data.list.length);
                    if (result.data.list.length > 0) {
                        $.each(result.data.list, function (i, o) {
                            oasID = o.oaId;
                            if (o.oaAutographOne != null && o.oaAutographOne != "") {
                                $("#oaAutographOne").attr("src", o.oaAutographOne);
                                frequency = (frequency + 1);
                            }
                            if (o.oaAutographTwo != null && o.oaAutographTwo != "") {
                                $("#oaAutographTwo").attr("src", o.oaAutographTwo);
                                frequency = (frequency + 1);
                            }
                            if (o.oaAutographThree != null && o.oaAutographThree != "") {
                                $("#oaAutographThree").attr("src", o.oaAutographThree);
                                frequency = (frequency + 1);
                            }
                            if (o.oaAutographFour != null && o.oaAutographFour != "") {
                                $("#oaAutographFour").attr("src", o.oaAutographFour);
                                frequency = (frequency + 1);
                            }
                            if (o.oaAutographFive != null && o.oaAutographFive != "") {
                                $("#oaAutographFive").attr("src", o.oaAutographFive);
                                frequency = (frequency + 1);
                            }
                            if (o.oaAutographSix != null && o.oaAutographSix != "") {
                                $("#oaAutographSix").attr("src", o.oaAutographSix);
                                frequency = (frequency + 1);
                            }
                            if (o.oaAutographSeven != null && o.oaAutographSeven != "") {
                                $("#oaAutographSeven").attr("src", o.oaAutographSeven);
                                frequency = (frequency + 1);
                            }
                            if (o.oaAutographEight != null && o.oaAutographEight != "") {
                                $("#oaAutographEight").attr("src", o.oaAutographEight);
                                frequency = (frequency + 1);
                            }
                            if (o.oaAutographNine != null && o.oaAutographNine != "") {
                                $("#oaAutographNine").attr("src", o.oaAutographNine);
                                frequency = (frequency + 1);
                            }
                            if (o.oaAutographTen != null && o.oaAutographTen != "") {
                                $("#oaAutographTen").attr("src", o.oaAutographTen);
                                frequency = (frequency + 1);
                            }
                            if (o.oaAutographEleven != null && o.oaAutographEleven != "") {
                                $("#oaAutographEleven").attr("src", o.oaAutographEleven);
                                frequency = (frequency + 1);
                            }
                            if (o.oaAutographTwelve != null && o.oaAutographTwelve != "") {
                                $("#oaAutographTwelve").attr("src", o.oaAutographTwelve);
                                frequency = (frequency + 1);
                            }
                            if (o.oaAutographThirteen != null && o.oaAutographThirteen != "") {
                                $("#oaAutographThirteen").attr("src", o.oaAutographThirteen);
                                frequency = (frequency + 1);
                            }
                            if (o.oaAutographFourteen != null && o.oaAutographFourteen != "") {
                                $("#oaAutographFourteen").attr("src", o.oaAutographFourteen);
                                frequency = (frequency + 1);
                            }
                            if (o.oaAutographFifteen != null && o.oaAutographFifteen != "") {
                                $("#oaAutographFifteen").attr("src", o.oaAutographFifteen);
                                frequency = (frequency + 1);
                            }
                            if (o.oaAutographSixteen != null && o.oaAutographSixteen != "") {
                                $("#oaAutographSixteen").attr("src", o.oaAutographSixteen);
                                frequency = (frequency + 1);
                            }
                            if (o.oaAutographSeventeen != null && o.oaAutographSeventeen != "") {
                                $("#oaAutographSeventeen").attr("src", o.oaAutographSeventeen);
                                frequency = (frequency + 1);
                            }
                            if (o.oaAutographEighteen != null && o.oaAutographEighteen != "") {
                                $("#oaAutographEighteen").attr("src", o.oaAutographEighteen);
                                frequency = (frequency + 1);
                            }
                            if (o.oaAutographNineteen != null && o.oaAutographNineteen != "") {
                                $("#oaAutographNineteen").attr("src", o.oaAutographNineteen);
                                frequency = (frequency + 1);
                            }
                            if (o.oaAutographTwenty != null && o.oaAutographTwenty != "") {
                                $("#oaAutographTwenty").attr("src", o.oaAutographTwenty);
                                frequency = (frequency + 1);
                            }
                            if (o.oaAutographTwentyOne != null && o.oaAutographTwentyOne != "") {
                                $("#oaAutographTwentyOne").attr("src", o.oaAutographTwentyOne);
                                frequency = (frequency + 1);
                            }
                            if (o.oaAutographTwentyTwo != null && o.oaAutographTwentyTwo != "") {
                                $("#oaAutographTwentyTwo").attr("src", o.oaAutographTwentyTwo);
                                frequency = (frequency + 1);
                            }
                            if (o.oaAutographTwentyThree != null && o.oaAutographTwentyThree != "") {
                                $("#oaAutographTwentyThree").attr("src", o.oaAutographTwentyThree);
                                frequency = (frequency + 1);
                            }
                            if (o.oaAutographTwentyFour != null && o.oaAutographTwentyFour != "") {
                                $("#oaAutographTwentyFour").attr("src", o.oaAutographTwentyFour);
                                frequency = (frequency + 1);
                            }
                        })
                        console.log(frequency);
                        $("#Broadcast").text("当前已签患者：" + frequency + "位");
                    } else {
                        /**
                         * 如无此id相关数据则开始签名
                         */
                        $("#Broadcast").text("当前已签患者：" + frequency + "位");
                    }
                },
                error: function (result) {
                    /**
                     *  提示错误信息
                     */
                    toast.fail({
                        title: "操作失败",
                        duration: 2000
                    });
                }
            })
        }
    }

    // //查询宣教记录表
    // function getHoOxygenAutographs(oaCorId) {
    //     var Url_IP = ToConfigure_IP("Gorgeous");
    //     var toast = new auiToast();
    //     if (oaCorId > 0 && oaCorId != null) {
    //         var JSparss = new Object;
    //         JSparss.oaCorId = oaCorId;
    //         console.log(JSON.stringify(JSparss))

    //         $.ajax({
    //             url: Url_IP + '/businessmanagement/cabinoperationrecord/getHoOxygenAutograph',
    //             type: 'post',
    //             async: false,
    //             contentType: "application/json",
    //             dataType: "json",
    //             data: JSON.stringify(JSparss),
    //             success: function (result) {

    //                 /**
    //                  * 验证返回信息是否为空
    //                  */
    //                 console.log(result.data.list.length);
    //                 if (result.data.list.length > 0) {
    //                     $.each(result.data.list, function (i, o) {
    //                         oasID = o.oaId;
    //                         if (o.oaAutographOne != null && o.oaAutographOne != "") {
    //                             $("#oaAutographOne").attr("src", o.oaAutographOne);
    //                         }
    //                         if (o.oaAutographTwo != null && o.oaAutographTwo != "") {
    //                             $("#oaAutographTwo").attr("src", o.oaAutographTwo);
    //                         }
    //                         if (o.oaAutographThree != null && o.oaAutographThree != "") {
    //                             $("#oaAutographThree").attr("src", o.oaAutographThree);
    //                         }
    //                         if (o.oaAutographFour != null && o.oaAutographFour != "") {
    //                             $("#oaAutographFour").attr("src", o.oaAutographFour);
    //                         }
    //                         if (o.oaAutographFive != null && o.oaAutographFive != "") {
    //                             $("#oaAutographFive").attr("src", o.oaAutographFive);
    //                         }
    //                         if (o.oaAutographSix != null && o.oaAutographSix != "") {
    //                             $("#oaAutographSix").attr("src", o.oaAutographSix);
    //                         }
    //                         if (o.oaAutographSeven != null && o.oaAutographSeven != "") {
    //                             $("#oaAutographSeven").attr("src", o.oaAutographSeven);
    //                             frequency = (frequency + 1);
    //                         }
    //                         if (o.oaAutographEight != null && o.oaAutographEight != "") {
    //                             $("#oaAutographEight").attr("src", o.oaAutographEight);
    //                         }
    //                         if (o.oaAutographNine != null && o.oaAutographNine != "") {
    //                             $("#oaAutographNine").attr("src", o.oaAutographNine);
    //                         }
    //                         if (o.oaAutographTen != null && o.oaAutographTen != "") {
    //                             $("#oaAutographTen").attr("src", o.oaAutographTen);
    //                         }
    //                         if (o.oaAutographEleven != null && o.oaAutographEleven != "") {
    //                             $("#oaAutographEleven").attr("src", o.oaAutographEleven);
    //                         }
    //                         if (o.oaAutographTwelve != null && o.oaAutographTwelve != "") {
    //                             $("#oaAutographTwelve").attr("src", o.oaAutographTwelve);
    //                         }
    //                         if (o.oaAutographThirteen != null && o.oaAutographThirteen != "") {
    //                             $("#oaAutographThirteen").attr("src", o.oaAutographThirteen);
    //                         }
    //                         if (o.oaAutographFourteen != null && o.oaAutographFourteen != "") {
    //                             $("#oaAutographFourteen").attr("src", o.oaAutographFourteen);
    //                         }
    //                         if (o.oaAutographFifteen != null && o.oaAutographFifteen != "") {
    //                             $("#oaAutographFifteen").attr("src", o.oaAutographFifteen);
    //                         }
    //                         if (o.oaAutographSixteen != null && o.oaAutographSixteen != "") {
    //                             $("#oaAutographSixteen").attr("src", o.oaAutographSixteen);
    //                         }
    //                         if (o.oaAutographSeventeen != null && o.oaAutographSeventeen != "") {
    //                             $("#oaAutographSeventeen").attr("src", o.oaAutographSeventeen);
    //                         }
    //                         if (o.oaAutographEighteen != null && o.oaAutographEighteen != "") {
    //                             $("#oaAutographEighteen").attr("src", o.oaAutographEighteen);
    //                         }
    //                         if (o.oaAutographNineteen != null && o.oaAutographNineteen != "") {
    //                             $("#oaAutographNineteen").attr("src", o.oaAutographNineteen);
    //                         }
    //                         if (o.oaAutographTwenty != null && o.oaAutographTwenty != "") {
    //                             $("#oaAutographTwenty").attr("src", o.oaAutographTwenty);
    //                         }
    //                         if (o.oaAutographTwentyOne != null && o.oaAutographTwentyOne != "") {
    //                             $("#oaAutographTwentyOne").attr("src", o.oaAutographTwentyOne);
    //                         }
    //                         if (o.oaAutographTwentyTwo != null && o.oaAutographTwentyTwo != "") {
    //                             $("#oaAutographTwentyTwo").attr("src", o.oaAutographTwentyTwo);
    //                         }
    //                         if (o.oaAutographTwentyThree != null && o.oaAutographTwentyThree != "") {
    //                             $("#oaAutographTwentyThree").attr("src", o.oaAutographTwentyThree);
    //                         }
    //                         if (o.oaAutographTwentyFour != null && o.oaAutographTwentyFour != "") {
    //                             $("#oaAutographTwentyFour").attr("src", o.oaAutographTwentyFour);
    //                         }
    //                     })
    //                     // console.log(frequency);
    //                     // $("#Broadcast").text("当前已签患者：" + frequency + "位");
    //                 } else {
    //                     // /**
    //                     //  * 如无此id相关数据则开始签名
    //                     //  */
    //                     // $("#Broadcast").text("当前已签患者：" + frequency + "位");
    //                 }
    //             },
    //             error: function (result) {
    //                 /**
    //                  *  提示错误信息
    //                  */
    //                 toast.fail({
    //                     title: "操作失败",
    //                     duration: 2000
    //                 });
    //             }
    //         })
    //     }
    // }
    //添加签名
    function insertHoOxygenAutograph(oaCorId, base64) {
        var JSpar = new Object;
        if (frequency == 0 && frequency != null && frequency != undefined) {
            JSpar.oaAutographOne = base64;
            JSpar.oaCorId = oaCorId;
        } else {
            return;
        }
        var toast = new auiToast();
        //获取所属医院IP地址
        var Url_IP = ToConfigure_IP("Gorgeous");
        /**
        * 请求控制器
        */
        $.ajax({
            url: Url_IP + '/businessmanagement/cabinoperationrecord/insertHoOxygenAutograph',
            type: 'post',
            async: false,
            contentType: "application/json",
            dataType: "json",
            data: JSON.stringify(JSpar),
            success: function (result) {

                /**
                 * 验证返回信息是否为空
                 */
                if (result.success == true) {
                    frequency = (frequency + 1);
                    //赋值宣教记录签名表主键
                    oasID = result.data;

                    /**
                     * 操作成功提醒
                     */
                    $("#Broadcast").text("当前已签患者：" + frequency + "位");
                    /**
                     * 调取签名
                     */
                    // openSign();

                    /**
                    * 关闭签名
                    */
                    closeSign();
                    // /**
                    //  * 清空已选中的checkbox
                    //  * 
                    // */
                    // document.getElementsByName("read")[0].checked = false;
                    toast.success({
                        title: "提交成功",
                        duration: 2000
                    });

                } else {
                    /**
                     *  提示错误信息
                     */
                    toast.fail({
                        title: "提交失败",
                        duration: 2000
                    });
                }
            },
            error: function (result) {
                /**
                 *  提示错误信息
                 */
                toast.fail({
                    title: "提交失败",
                    duration: 2000
                });
            }
        })
    }
    // 关闭弹窗
    function closewin() {
        api.closeWin({
            name: 'missionPatient'
        });
    }



    // 打开电子签名板
    function openSign() {
        var dialog = new auiDialog();
        if (document.getElementsByName("read")[0].checked) {
            if (frequency < 24) {
                $('#caozuo').show();
                // 画板
                var drawingBoard = api.require('drawingBoard');
                drawingBoard.open({
                    rect: {
                        x: 17,
                        y: api.winHeight - 700,
                        w: api.winWidth - 35,
                        h: 400
                    },
                    styles: {
                        brush: {
                            color: '#000000',
                            width: 3
                        },
                        bgColor: 'rgba(0, 0, 0, .6)'
                    },
                    fixedOn: api.frameName
                });
            } else {
                dialog.alert({
                    title: "温馨提示",
                    msg: '签名人数已满，无法继续签名。',
                    buttons: ['确定']
                })
            }
        }
        else {
            if (ret.buttonIndex === 2) {
                document.getElementsByName("read")[0].checked = true;
            }
        }
    }

    // 撤销最新的一笔
    function cancelStep() {
        var drawingBoard = api.require('drawingBoard');
        drawingBoard.revoke();
    }

    // 关闭签名
    function closeSign() {
        var drawingBoard = api.require('drawingBoard');
        drawingBoard.close();
        $('#caozuo').hide();

        // api.confirm({
        //     title: '是否确定关闭签名？',
        //     buttons: ['确定', '取消']
        // }, function (ret, err) {
        //     if (ret) {
        //         if (ret.buttonIndex === 1) {
        //             drawingBoard.close();
        //             $('#caozuo').hide();
        //         }
        //     }
        // })
    }

    // 恢复撤销
    function revocationSign() {
        var drawingBoard = api.require('drawingBoard');
        drawingBoard.restore();
    }

    // 清除全部
    function clearSign() {
        var drawingBoard = api.require('drawingBoard');
        api.confirm({
            title: '是否确定清除全部？',
            buttons: ['确定', '取消']
        }, function (ret, err) {
            if (ret) {
                if (ret.buttonIndex === 1) {
                    drawingBoard.clear();
                }
            }
        })
    }

    // 保存签名要确定
    function saveSign() {
        api.confirm({
            title: '是否确定保存？',
            msg: '请检查签名是否书写正确',
            buttons: ['确定', '取消']
        }, function (ret, err) {
            if (ret) {
                if (ret.buttonIndex === 1) {
                    var drawingBoard = api.require('drawingBoard');
                    drawingBoard.save({
                        savePath: 'fs://hyperbaric/result.png',
                        copyToAlbum: false
                    }, function (ret) {
                        if (ret.absolutePath) {
                            convert2Base(ret.absolutePath);
                            drawingBoard.close();
                            $('#caozuo').hide();
                        } else {
                            api.toast({
                                msg: '保存失败',
                                duration: 1000,
                                location: 'bottom'
                            });
                        }
                    });
                }
            } else {
                api.toast({
                    msg: '操作异常',
                    duration: 1000,
                    location: 'bottom'
                });
            }
        });
    }
    /**
     * 
     * 签名不要确定
     * */
    function saveSigns() {
        var drawingBoard = api.require('drawingBoard');
        drawingBoard.save({
            savePath: 'fs://hyperbaric/result.png',
            copyToAlbum: false
        }, function (ret) {
            if (ret.absolutePath) {
                convert2Base(ret.absolutePath);
                drawingBoard.close();
                $('#caozuo').hide();
            } else {
                api.toast({
                    msg: '保存失败',
                    duration: 1000,
                    location: 'bottom'
                });
            }
        });

    }

    function convert2Base(photoPath) {
        //获取所属医院IP地址
        var Url_IP = ToConfigure_IP("Gorgeous");

        var toast = new auiToast();
        var UserId = Get_User_Id();
        if (UserId != "") {
            var trans = api.require('trans');
            trans.decodeImgToBase64({
                imgPath: photoPath
            }, function (ret, err) {
                if (ret.status) {
                    var base64Data = "data:image/png;base64," + ret.base64Str;
                    //签名图片
                    // console.log(base64Data);
                    if (frequency < 24) {
                        if (frequency > 0 && frequency != null && frequency != undefined) {
                            if (oasID > 0 && oasID != null && oasID != undefined) {
                                updateHoOxygenAutograph(oasID, base64Data);
                            } else {
                                return;
                            }
                        } else {
                            insertHoOxygenAutograph(api.pageParam.F_HatchID, base64Data)
                        }
                    } else {
                        alert("舱内人员已满无法继续签字。");
                    }

                } else {
                    toast.fail({
                        title: "提交失败",
                        duration: 2000
                    });
                }
            });
        }
    }

    //获取用户ID
    function Get_User_Id() {
        //api.getPrefs获取当前登录状态
        api.getPrefs({
            key: 'User_Id'
        }, function (ret, err) {
            //当偏好设置尚未设置或者曾设置后被移除后，返回值(ret.value)均为空。
            var val = ret.value;
            if (val != "") {
                return val;
            } else {
                //未登录
                return "";
            }
        });
    }
</script>